package com.systemframework.sys.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.systemframework.sys.dto.request.SysLogRequestDTO;
import com.systemframework.sys.dto.response.SysLogResponseDTO;
import com.systemframework.sys.entity.SysLog;
import com.systemframework.sys.mapper.SysLogMapper;
import com.systemframework.sys.service.SysLogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author summer
 * @date 2023-03-21 17:35
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {


    @Override
    public Page<SysLogResponseDTO> lists(SysLogRequestDTO sysLogRequestDTO) {
        Page<SysLogResponseDTO> page=new Page<>(sysLogRequestDTO.getPageNum(),sysLogRequestDTO.getPageSize());
        if(sysLogRequestDTO.getCreateTime().size()>0){
            sysLogRequestDTO.setStartTime(sysLogRequestDTO.getCreateTime().get(0));
            sysLogRequestDTO.setEndTime(sysLogRequestDTO.getCreateTime().get(1));
        }
        return this.baseMapper.lists(sysLogRequestDTO,page);
    }
}
